/*
 * @Author: Zhou Zijian
 * @Date: 2023-03-02 00:29:42
 * @Last Modified by: Zhou Zijian
 * @Last Modified time: 2023-05-07 17:33:34
 */

#ifndef CONFIG_PARSER_H
#define CONFIG_PARSER_H

#include <string>
#include <vector>
#include "nlohmann/json.hpp"

class ConfigParser {
public:
    enum ErrorCode {
        OPEN_FILE_FAILED = -4,
        CHECK_PROGRAM_FAILED,
        CHECK_FUNCTIONS_FAILED,
        CHECK_FUNCTION_FAILED,
        SUCCESS,
    };
    struct Function {
        std::string name;
        std::string kernel;
        std::vector<size_t> globalWorkSize;
        std::vector<size_t> localWorkSize;
    };

public:
    int LoadJson(const std::string &json);
    std::string GetProgram();
    std::vector<Function> GetFunctions();
    std::string GetOpencl();

private:
    nlohmann::json data;
};

#endif  // CONFIG_PARSER_H